import axios from "axios";
import Cookies from 'js-cookie';

// 创建 axios 实例

// const baseURL = "http://192.168.151.254:8080/yaqxfw"

//石
const baseURL = 'http://localhost:8080/yaqxfw'


const Request = axios.create({
  baseURL,
  timeout: 10000,
  headers: {
      "Content-Type": "application/json; charset=utf-8",
     
  },
});

// 请求拦截器
Request.interceptors.request.use(
  // function (config) {
  //   const token = Cookies.get("token");// 从 cookie 中获取 token
  //   if (token) {
  //     config.headers["Authorization"] = `Bearer ${token}`;
  //   }
  //   return config;
  // },
  function (error) {
    return Promise.reject(error);
  }
);

// 响应拦截器
Request.interceptors.response.use(
  function (response) {
    return response;
  },
  function (error) {
    return Promise.reject(error);
  }
);

export default Request;
export { baseURL };
